package com.pangzhao.prize.commons.db.mapper;

import com.pangzhao.prize.commons.db.entity.CommonFile;
import com.pangzhao.prize.commons.db.entity.CommonFileExample;
import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface CommonFileMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table common_file
     *
     * @mbg.generated
     */
    long countByExample(CommonFileExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table common_file
     *
     * @mbg.generated
     */
    int deleteByExample(CommonFileExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table common_file
     *
     * @mbg.generated
     */
    @Delete({
        "delete from common_file",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table common_file
     *
     * @mbg.generated
     */
    @Insert({
        "insert into common_file (type, path, ",
        "sys_user_id, create_time)",
        "values (#{type,jdbcType=INTEGER}, #{path,jdbcType=VARCHAR}, ",
        "#{sysUserId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(CommonFile record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table common_file
     *
     * @mbg.generated
     */
    int insertSelective(CommonFile record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table common_file
     *
     * @mbg.generated
     */
    List<CommonFile> selectByExample(CommonFileExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table common_file
     *
     * @mbg.generated
     */
    @Select({
        "select",
        "id, type, path, sys_user_id, create_time",
        "from common_file",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("com.pangzhao.prize.commons.db.mapper.CommonFileMapper.BaseResultMap")
    CommonFile selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table common_file
     *
     * @mbg.generated
     */
    int updateByExampleSelective(@Param("record") CommonFile record, @Param("example") CommonFileExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table common_file
     *
     * @mbg.generated
     */
    int updateByExample(@Param("record") CommonFile record, @Param("example") CommonFileExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table common_file
     *
     * @mbg.generated
     */
    int updateByPrimaryKeySelective(CommonFile record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table common_file
     *
     * @mbg.generated
     */
    @Update({
        "update common_file",
        "set type = #{type,jdbcType=INTEGER},",
          "path = #{path,jdbcType=VARCHAR},",
          "sys_user_id = #{sysUserId,jdbcType=INTEGER},",
          "create_time = #{createTime,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(CommonFile record);
}